import { defineStore } from 'pinia'
import { userApi } from '../../api'

export const useUserStore = defineStore('user', {
  state: () => ({
    loginUser: {}
  }),
  getters: {},
  actions: {
    async loginByPassword({ username, password }) {
      const user = await userApi.loginPost({ username, password })
      this.loginUser = user
      return user
    }
  }
})
